package com.lcc.trans.controller;

import com.lcc.trans.service.LogService;
import com.lcc.trans.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RequestMapping("/proga")
@RestController
public class ProController {
    @Autowired
    private UserService userService;

    @Autowired
    private LogService logService;
    @Transactional
    @RequestMapping("/p1")
    public String p1(String userName,String password){
        Integer result = userService.insertUser(userName,password);
        log.info("用户插入成功,result:" + result);

        Integer result1 = logService.insert(userName,"用户注册成功");
        log.info("日志表插入成功，result:" + result1);
        return "注册成功";
    }
}
